package cn.edu.scau.cmi.linzhanyi.finalexam;

import java.io.IOException;
import java.util.Random;

import cn.edu.scau.cmi.linzhanyi.factory.GetFactory;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class Controller {
	@FXML
	private Pane pane;
	
	public void initialize(){
    	
        pane.setStyle("-fx-background-image: url("+getClass().getResource((new Random().nextInt(2)+2)+""+".jpg")+"); -fx-background-repeat: no-repeat; -fx-background-size: stretch;");


    }
	public void InterProgrammingClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/interProgramming/sample.fxml"));
	    primaryStage.setTitle("实现接口");
	    primaryStage.setScene(new Scene(root, 600, 500));
	    primaryStage.show();
	}
	public void SingletonClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/singleton/sample.fxml"));
        primaryStage.setTitle("单/多例模式");
        primaryStage.setScene(new Scene(root, 600, 400));
        primaryStage.setResizable(true);
        primaryStage.show();
	}
	public void SimpleFactoryMethodClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/simpleFactoryMethod/sample.fxml"));       
        primaryStage.setTitle("简单工厂模式");
        primaryStage.setScene(new Scene(root, 700, 550));
        primaryStage.show();
	}
	public void FactoryClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/factory/sample.fxml"));
        primaryStage.setTitle("工厂方法模式");
        primaryStage.setScene(new Scene(root, 600, 500));
        primaryStage.show();
	}
	public void AbstractFactoryClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/abstractFactory/sample.fxml"));
        primaryStage.setTitle("抽象工厂模式");
        primaryStage.setScene(new Scene(root, 700, 550));
        primaryStage.show();
	}
	public void AdapterClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/adapter/sample.fxml"));
        primaryStage.setTitle("类/对象适配器模式");
        primaryStage.setScene(new Scene(root, 600, 400));
        primaryStage.show();
	}
	public void CompositeClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/composite/sample.fxml"));
        primaryStage.setTitle("组合模式");
        primaryStage.setScene(new Scene(root, 600, 500));
        primaryStage.show();
	}
	public void HibernateClient() throws IOException {
		Stage primaryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linzhanyi/hibernate/sample.fxml"));
        primaryStage.setTitle("Hibernate框架模式");
        primaryStage.setScene(new Scene(root, 600, 500));
        primaryStage.show();
	}
}
